package com.chen.bq;

import java.util.concurrent.ArrayBlockingQueue;

// 这组API，阻塞等待
public class BlockingQueueTest3 {
    public static void main(String[] args) throws InterruptedException {

        // 队列大小3
        ArrayBlockingQueue<String> blockingQueue = new ArrayBlockingQueue<>(3);

        blockingQueue.put("a");
        blockingQueue.put("b");
        blockingQueue.put("c");
        // 程序阻塞等待
        // blockingQueue.put("d");

        System.out.println(blockingQueue.take());
        System.out.println(blockingQueue.take());
        System.out.println(blockingQueue.take());
        // 程序阻塞等待
        // System.out.println(blockingQueue.take());

    }
}
